package com.bdqn.zhang;


import android.os.Handler;
import android.os.Message;

import com.alibaba.fastjson.JSONObject;

/**
 * 网络访问
 * Created by lyh on 2019/6/6.
 */

public class NetThread extends Thread{
    private static final String url_prefix ="url地址";

    private String url;
    private JSONObject json;
    private JSONObject json_get;
    private Handler handler;

    public NetThread(String url_suffix, Handler handler,JSONObject json){
        this.url=url_prefix+url_suffix;
        this.handler=handler;
        this.json=json;
    }

//    @Override
//    public void run(){
//        super.run();
//        json_get=post(json);
//        if(json_get!=null){
//            Log.e("json_get",json_get.toString());
//        }
//
//        dealResult();
//    }

    public void dealResult(){
        /*
        返回结果
         */
        Message message = new Message();
        message.what=1;
        if(json_get==null){
            message.what=0;
        }
        message.obj = json_get;
        handler.sendMessage(message);
    }
}